<template>
  <div class="page">
    <div class="main">
      <el-card class="box-card" style="height:800px">
        <div slot="header" class="clearfix">
          <span>
            <navigation />
          </span>
          <el-button @click="goBack" type="primary" size="small">返回</el-button>
        </div>
        <b
          style="margin-left:10px;font-size:14px;position: relative;top: -10px;"
        >{{ $route.query.name }}</b>
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick" :before-leave="Tabever">
          <el-tab-pane label="市级" name="first">
            <el-table
              border
              :data="tableData"
              style="width: 100%"
              height="600px"
              size="small"
              :header-cell-style="{ background: '#f5f5f5' }"
            >
              <el-table-column align="center" type="index" label="序号"></el-table-column>
              <el-table-column align="center" width="80" prop="departmentTypeName" label="单位类别"></el-table-column>
              <el-table-column align="center" width="200" prop="departmentName" label="单位名称"></el-table-column>

              <el-table-column align="center" label="一季度">
                <el-table-column align="center" width="60" prop="score1" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank1" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank1 }}</b>
                      <img :src="scope.row.imgUrl1" v-if="scope.row.imgUrl1 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription1" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription1"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription1"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 1)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status1" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status1 == 1
                    ? "待审核"
                    : scope.row.status1 == 2
                    ? "审核通过"
                    : scope.row.status1 == -1
                    ? "驳回"
                    : scope.row.score1 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="二季度">
                <el-table-column align="center" width="60" prop="score2" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank2" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank2 }}</b>
                      <img :src="scope.row.imgUrl2" v-if="scope.row.imgUrl2 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription2" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription2"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription2"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 2)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status2" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status2 == 1
                    ? "待审核"
                    : scope.row.status2 == 2
                    ? "审核通过"
                    : scope.row.status2 == -1
                    ? "驳回"
                    : scope.row.score2 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="三季度">
                <el-table-column align="center" width="60" prop="score3" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank3" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank3 }}</b>
                      <img :src="scope.row.imgUrl3" v-if="scope.row.imgUrl3 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription3" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription3"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription3"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 3)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status3" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status3 == 1
                    ? "待审核"
                    : scope.row.status3 == 2
                    ? "审核通过"
                    : scope.row.status3 == -1
                    ? "驳回"
                    : scope.row.score3 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="第四季度">
                <el-table-column align="center" width="60" prop="score4" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank4" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank4 }}</b>
                      <img :src="scope.row.imgUrl4" v-if="scope.row.imgUrl4 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription4" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription4"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription4"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 4)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status4" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status4 == 1
                    ? "待审核"
                    : scope.row.status4 == 2
                    ? "审核通过"
                    : scope.row.status4 == -1
                    ? "驳回"
                    : scope.row.score4 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="区县" name="second">
            <el-table
              border
              :data="tableData"
              style="width: 100%"
              height="600px"
              size="small"
              :header-cell-style="{ background: '#f5f5f5' }"
            >
              <el-table-column align="center" type="index" label="序号"></el-table-column>
              <el-table-column align="center" width="80" prop="departmentTypeName" label="单位类别"></el-table-column>
              <el-table-column align="center" width="200" prop="departmentName" label="单位名称"></el-table-column>

              <el-table-column align="center" label="一季度">
                <el-table-column align="center" width="60" prop="score1" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank1" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank1 }}</b>
                      <img :src="scope.row.imgUrl1" v-if="scope.row.imgUrl1 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription1" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription1"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription1"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 1)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status1" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status1 == 1
                    ? "待审核"
                    : scope.row.status1 == 2
                    ? "审核通过"
                    : scope.row.status1 == -1
                    ? "驳回"
                    : scope.row.score1 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="二季度">
                <el-table-column align="center" width="60" prop="score2" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank2" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank2 }}</b>
                      <img :src="scope.row.imgUrl2" v-if="scope.row.imgUrl2 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription2" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription2"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription2"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 2)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status2" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status2 == 1
                    ? "待审核"
                    : scope.row.status2 == 2
                    ? "审核通过"
                    : scope.row.status2 == -1
                    ? "驳回"
                    : scope.row.score2 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="三季度">
                <el-table-column align="center" width="60" prop="score3" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank3" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank3 }}</b>
                      <img :src="scope.row.imgUrl3" v-if="scope.row.imgUrl3 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription3" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription3"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription3"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 3)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status3" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status3 == 1
                    ? "待审核"
                    : scope.row.status3 == 2
                    ? "审核通过"
                    : scope.row.status3 == -1
                    ? "驳回"
                    : scope.row.score3 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="第四季度">
                <el-table-column align="center" width="60" prop="score4" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank4" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank4 }}</b>
                      <img :src="scope.row.imgUrl4" v-if="scope.row.imgUrl4 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription4" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription4"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription4"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 4)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status4" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status4 == 1
                    ? "待审核"
                    : scope.row.status4 == 2
                    ? "审核通过"
                    : scope.row.status4 == -1
                    ? "驳回"
                    : scope.row.score4 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="西咸新区" name="fourth">
            <el-table
              border
              :data="tableData"
              style="width: 100%"
              height="600px"
              size="small"
              :header-cell-style="{ background: '#f5f5f5' }"
            >
              <el-table-column align="center" type="index" label="序号"></el-table-column>
              <el-table-column align="center" width="80" prop="departmentTypeName" label="单位类别"></el-table-column>
              <el-table-column align="center" width="200" prop="departmentName" label="单位名称"></el-table-column>

              <el-table-column align="center" label="一季度">
                <el-table-column align="center" width="60" prop="score1" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank1" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank1 }}</b>
                      <img :src="scope.row.imgUrl1" v-if="scope.row.imgUrl1 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription1" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription1"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription1"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 1)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status1" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status1 == 1
                    ? "待审核"
                    : scope.row.status1 == 2
                    ? "审核通过"
                    : scope.row.status1 == -1
                    ? "驳回"
                    : scope.row.score1 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="二季度">
                <el-table-column align="center" width="60" prop="score2" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank2" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank2 }}</b>
                      <img :src="scope.row.imgUrl2" v-if="scope.row.imgUrl2 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription2" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription2"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription2"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 2)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status2" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status2 == 1
                    ? "待审核"
                    : scope.row.status2 == 2
                    ? "审核通过"
                    : scope.row.status2 == -1
                    ? "驳回"
                    : scope.row.score2 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="三季度">
                <el-table-column align="center" width="60" prop="score3" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank3" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank3 }}</b>
                      <img :src="scope.row.imgUrl3" v-if="scope.row.imgUrl3 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription3" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription3"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription3"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 3)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status3" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status3 == 1
                    ? "待审核"
                    : scope.row.status3 == 2
                    ? "审核通过"
                    : scope.row.status3 == -1
                    ? "驳回"
                    : scope.row.score3 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="第四季度">
                <el-table-column align="center" width="60" prop="score4" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank4" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank4 }}</b>
                      <img :src="scope.row.imgUrl4" v-if="scope.row.imgUrl4 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription4" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription4"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription4"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 4)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status4" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status4 == 1
                    ? "待审核"
                    : scope.row.status4 == 2
                    ? "审核通过"
                    : scope.row.status4 == -1
                    ? "驳回"
                    : scope.row.score4 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="开发区" name="third">
            <el-table
              border
              :data="tableData"
              style="width: 100%"
              height="600px"
              size="small"
              :header-cell-style="{ background: '#f5f5f5' }"
            >
              <el-table-column align="center" type="index" label="序号"></el-table-column>
              <el-table-column align="center" width="80" prop="departmentTypeName" label="单位类别"></el-table-column>
              <el-table-column align="center" width="200" prop="departmentName" label="单位名称"></el-table-column>

              <el-table-column align="center" label="一季度">
                <el-table-column align="center" width="60" prop="score1" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank1" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank1 }}</b>
                      <img :src="scope.row.imgUrl1" v-if="scope.row.imgUrl1 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription1" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription1"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription1"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 1)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status1" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status1 == 1
                    ? "待审核"
                    : scope.row.status1 == 2
                    ? "审核通过"
                    : scope.row.status1 == -1
                    ? "驳回"
                    : scope.row.score1 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="二季度">
                <el-table-column align="center" width="60" prop="score2" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank2" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank2 }}</b>
                      <img :src="scope.row.imgUrl2" v-if="scope.row.imgUrl2 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription2" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription2"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription2"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 2)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status2" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status2 == 1
                    ? "待审核"
                    : scope.row.status2 == 2
                    ? "审核通过"
                    : scope.row.status2 == -1
                    ? "驳回"
                    : scope.row.score2 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="三季度">
                <el-table-column align="center" width="60" prop="score3" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank3" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank3 }}</b>
                      <img :src="scope.row.imgUrl3" v-if="scope.row.imgUrl3 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription3" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription3"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription3"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 3)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status3" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status3 == 1
                    ? "待审核"
                    : scope.row.status3 == 2
                    ? "审核通过"
                    : scope.row.status3 == -1
                    ? "驳回"
                    : scope.row.score3 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
              <el-table-column align="center" label="第四季度">
                <el-table-column align="center" width="60" prop="score4" label="分数"></el-table-column>
                <el-table-column align="center" width="60" prop="rank4" label="排名">
                  <template slot-scope="scope">
                    <span class="lightSty">
                      <b>{{ scope.row.rank4 }}</b>
                      <img :src="scope.row.imgUrl4" v-if="scope.row.imgUrl4 != null" />
                    </span>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="rankDescription4" label="描述">
                  <template slot-scope="scope">
                    <el-popover
                      placement="top-start"
                      title="描述"
                      width="200"
                      trigger="click"
                      :content="scope.row.rankDescription4"
                    >
                      <el-button
                        slot="reference"
                        v-if="scope.row.rankDescription4"
                        class="describe"
                      >描述</el-button>
                    </el-popover>
                  </template>
                </el-table-column>
                <el-table-column align="center" width="100" label="附件">
                  <template slot-scope="scope">
                    <el-button type="warning" size="mini" @click="handFileList(scope.row, 4)">附件</el-button>
                  </template>
                </el-table-column>
                <el-table-column align="center" prop="status4" label="状态">
                  <template slot-scope="scope">
                    {{
                    scope.row.status4 == 1
                    ? "待审核"
                    : scope.row.status4 == 2
                    ? "审核通过"
                    : scope.row.status4 == -1
                    ? "驳回"
                    : scope.row.score4 != null
                    ?"未审核":''
                    }}
                  </template>
                </el-table-column>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-card>
      <el-dialog
        width="60%"
        title="附件列表配置"
        :visible.sync="dialogFormVisible"
        :close-on-click-modal="false"
        @closed="closeDialog"
      >
        <!-- <el-form
          :inline="true"
          label-width="95px"
          :model="dutyFrom"
          :hide-required-asterisk="false"
        >
          <el-form-item label="附件：" prop="file">
            <el-upload
              class="upload-demo"
              :action="uploadUrl"
              :on-success="successFile"
              :on-remove="handleDealFileRemove"
              :file-list="fileList"
              multiple
              ref="rebateUpload"
            >
              <el-button size="small" type="primary">点击上传</el-button>
            </el-upload>
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              class="saveBtn"
              type="primary"
              @click="submitForms"
              >添加</el-button
            >
          </el-form-item>
        </el-form>-->
        <el-table
          :data="fileTableData"
          border
          style="width: 100%"
          :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
        >
          <el-table-column prop="file" label="附件名称">
            <template slot-scope="scope">
              <a :href="returnFile(scope.row.file)">{{ scope.row.file }}</a>
            </template>
          </el-table-column>
          <el-table-column label="上传时间">
            <template slot-scope="scope">{{ scope.row.fileAddTime }}</template>
          </el-table-column>

          <el-table-column label="上传人" prop="userName"></el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button type="danger" @click="deleteFile(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import configJson from "../../api/config";
export default {
  data() {
    return {
      targetId: this.$route.query.id,
      tableData: [],
      typeLight: "",
      showAddFormdialog: false,
      taskForm: {
        departmentId: "",
        type: 2,
        quarter: "",
        id: "",
        status: "",
        regectMsg: "",
      },
      quarterList: [
        { id: 1, name: "第一季度" },
        { id: 2, name: "第二季度" },
        { id: 3, name: "第三季度" },
        { id: 4, name: "第四季度" },
      ],
      btnStatus: true,
      activeName: "first",
      fileList: [],
      dialogFormVisible: false,
      // 附件上传模块
      dutyFrom: {
        id: "",
        taskId: "",
        year: "",
        quarter: "",
        file: [],
        fileType: "",
      },
      uploadUrl: configJson.API_URL + "fileController/uploadFile", //地址
      fileTableData: [],
    };
  },
  mounted() {
    this.getListByPage(1);
  },
  methods: {
    Tabever(activeName, oldActiveName) {
      // console.log(activeName)
      if (activeName == "first") {
        this.getListByPage(1);
      } else if (activeName == "second") {
        this.getListByPage(2);
      } else if (activeName == "third") {
        this.getListByPage(3);
      } else if (activeName == "fourth") {
        this.getListByPage(4);
      }
    },
    handleClick(tab, event) {
      // console.log(tab, event);
    },
    // 上传附件列表
    handFileList(row, index) {
      console.log(row);
      this.secondAimsId = row.departmentId;
      this.fileQuarter = index;
      this.getfileList();
      this.dialogFormVisible = true;
    },
    // 获取附件列表
    getfileList() {
      this.$axios
        .post(`/fileController/getListDaily`, {
          taskId: this.$route.query.id,
          secondAimsId: this.secondAimsId,
          fileQuarter: this.fileQuarter,
          type: 2,
        })
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.fileTableData = res.data;
            this.fileName = "";
            this.fileList = [];
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 添加附件
    submitForms() {
      if (this.dutyFrom.file == "") {
        this.$message.error("请选择附件");
      }
      let _obj = {
        aimsId: this.$route.query.id,
        files: this.dutyFrom.file,
        secondAimsId: this.secondAimsId,
        type: "2",
        fileQuarter: this.fileQuarter,
      };
      this.$axios
        .post(`fileController/addFile`, _obj)
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.$message({
              message: "数据更新成功",
              type: "success",
            });
            this.closeDialog();
            this.getfileList();
            this.dutyFrom.fileQuarter = "";
            this.dutyFrom.file = [];
            this.secondAimsId = "";
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    returnFile(val) {
      return `${configJson.API_URL}/fileController/${val}`;
    },
    closeDialog() {
      this.dutyFrom = {
        year: "",
        quarter: "",
        file: [],
        taskId: "",
        id: "",
        fileType: "",
      };
    },
    // 选择附件
    successFile(response, file, fileList) {
      console.log(response);
      if (response.code == 200) {
        this.fileList = fileList;
        console.log(this.fileList);
        let fileUrlStr = this.uploadUrl.split("/");
        let fileRemoveChl = fileUrlStr.slice(0, fileUrlStr.length - 1);
        this.fileUrlEnd = fileRemoveChl.join("/");
        this.fileName = this.fileUrlEnd + "/" + response.data;
        console.log(response.data);
        let _text = response.data;

        console.log(Array.isArray(this.dutyFrom.file));
        console.log(this.dutyFrom.file);
        this.dutyFrom.file.push(_text); //获取上传文件名
        console.log(this.dutyFrom.file);
      }
    },
    handleDealFileRemove(file, fileList) {
      this.fileList = fileList;
      this.fileName = "";
    },
    uploadExceed(files, fileList) {
      this.$set(fileList[0], "raw", files[0]);
      this.$set(fileList[0], "name", files[0].name);
      this.$refs["rebateUpload"].clearFiles(); //清除文件
      this.$refs["rebateUpload"].handleStart(files[0]); //选择文件后的赋值方法
      this.fileName = this.fileUrlEnd + "/" + files[0].name;
    },
    // 删除列表附件
    deleteFile(val) {
      this.$axios
        .post(
          `/fileController/deleteFileLib`,
          {
            id: val.id,
          },
          2
        )
        .then((res) => {
          if (res.code == 200) {
            console.log(res);
            this.$message({
              message: "数据更新成功",
              type: "success",
            });
            this.getfileList();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    currChange() {
      this.getDeptQuarter();
    },
    goBack() {
      this.$router.go(-1);
    },
    // 获取数据列表
    getListByPage(data) {
      this.$axios
        .post("deptTask/getDeptScoreList", {
          taskId: this.targetId,
          departmentTypeId: data,
        })
        .then((res) => {
          if (res.code == 200) {
            for (let i = 0; i < res.data.length; i++) {
              res.data[i]["imgUrl"] == null;

              // 第一季度
              if (res.data[i].caveat1 == 1) {
                res.data[i].imgUrl1 = require("../../assets/img/redFlag.png");
              } else if (res.data[i].caveat1 == 0) {
                res.data[i].imgUrl1 = require("../../assets/img/yellowLight.png");
              } else {
                res.data[i].imgUrl1 = null;
              }
              // 第二季度
              if (res.data[i].caveat2 == 1) {
                res.data[i].imgUrl2 = require("../../assets/img/redFlag.png");
              } else if (res.data[i].caveat2 == 0) {
                res.data[i].imgUrl2 = require("../../assets/img/yellowLight.png");
              } else {
                res.data[i].imgUrl2 = null;
              }
              // 第三季度
              if (res.data[i].caveat3 == 1) {
                res.data[i].imgUrl3 = require("../../assets/img/redFlag.png");
              } else if (res.data[i].caveat3 == 0) {
                res.data[i].imgUrl3 = require("../../assets/img/yellowLight.png");
              } else {
                res.data[i].imgUrl3 = null;
              }
              // 第四季度
              if (res.data[i].caveat4 == 1) {
                res.data[i].imgUrl4 = require("../../assets/img/redFlag.png");
              } else if (res.data[i].caveat4 == 0) {
                res.data[i].imgUrl4 = require("../../assets/img/yellowLight.png");
              } else {
                res.data[i].imgUrl4 = null;
              }

              // if (res.data[i].lamp == 1) {
              //   res.data[i].imgUrl = require("../../assets/img/redFlag.png");
              // } else if (res.data[i].lamp == 0) {
              //   res.data[
              //     i
              //   ].imgUrl = require("../../assets/img/yellowLight.png");
              // }
            }
            console.log(res.data);
            this.tableData = res.data;
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 审核
    dataGrade(row) {
      this.showAddFormdialog = true;
      this.taskForm.departmentId = row.departmentId;
      this.btnStatus = true;
    },
    regect(row) {
      this.showAddFormdialog = true;
      this.taskForm.departmentId = row.departmentId;
      this.btnStatus = false;
    },
    brLight(row) {
      if (row.caveat == 0) {
        this.typeLight = 1;
      } else if (row.caveat == 1) {
        this.typeLight = 2;
      }
      let obj = {
        id: row.departmentId,
        caveat: this.typeLight,
      };
      this.$axios
        .post("dept/update", obj, 2)
        .then((res) => {
          if (res.code == 200) {
            this.getListByPage();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    closeLight(row) {
      if (row.caveat == 2) {
        this.typeLight = 0;
      } else if (row.caveat == 1) {
        this.typeLight = 0;
      }
      let obj = {
        id: row.departmentId,
        caveat: this.typeLight,
      };
      this.$axios
        .post("dept/update", obj, 2)
        .then((res) => {
          if (res.code == 200) {
            this.getListByPage();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    quarterChange(val) {
      let obj = {
        departmentId: this.taskForm.departmentId,
        type: 2,
        time: this.taskForm.quarter,
      };
      this.$axios
        .post("deptScore/load", obj, 2)
        .then((res) => {
          if (res.code == 200) {
            if (res.data) {
              this.taskForm.id = res.data.departmentId;
              this.taskForm.status = res.data.status;
            } else {
              this.taskForm.id = "";
              this.taskForm.status = "";
            }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    submitForm() {
      if (this.taskForm.id) {
        let obj = {
          departmentId: this.taskForm.id,
          quarter: this.taskForm.quarter,
        };
        if (this.btnStatus) {
          if (this.taskForm.status == 1) {
            obj.status = 1;
            this.getStatus(obj);
          } else if (this.taskForm.status == 2) {
            this.$message({
              message: "审核通过状态不能再通过",
              type: "success",
            });
          } else {
            this.$message({
              message: "此状态不能再通过",
              type: "success",
            });
          }
        } else {
          if (this.taskForm.status == 2) {
            obj.status = -1;
            obj.message = this.taskForm.regectMsg;
            this.getStatus(obj);
          } else if (this.taskForm.status == -1) {
            this.$message({
              message: "驳回状态,不能驳回",
              type: "success",
            });
          } else {
            this.$message({
              message: "此状态,不能驳回",
              type: "success",
            });
          }
        }
      } else {
        this.$message({
          message: "请先给该季度打分然后再申请审核!",
          type: "warning",
        });
      }
      setTimeout(() => {
        this.showAddFormdialog = false;
      }, 500);
    },
    getStatus(obj) {
      this.$axios
        .post("departmentScoreCheckLog/update", obj, 2)
        .then((res) => {
          if (res.code == 200) {
            if (res.data) {
              if (this.btnStatus) {
                this.$message({
                  message: "审核通过",
                  type: "success",
                });
              } else {
                this.$message({
                  message: "驳回",
                  type: "success",
                });
              }
              this.getListByPage();
              this.showAddFormdialog = false;
            }
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    cancelForm() {
      this.taskForm = {
        departmentId: "",
        type: 2,
        quarter: "",
        id: "",
        status: "",
        regectMsg: "",
      };
    },
  },
};
</script>
<style scoped>
.page {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.main {
  width: 100%;
  height: 100%;
}
.clearfix {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}
.lightSty {
  display: inline-block;
  width: 30px;
  text-align: left;
}
/* .lightSty img {
  width: 100%;
  height: 100%;
} */
.userIntSize {
  width: 80%;
}
.describe {
  padding: 4px 4px;
}
</style>
